<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <input type="text" id="i1">
    <input type="button" value="添加帅哥" onclick="f(1)">
    <input type="button" value="添加美女" onclick="f(2)">
    <script>
        let input = document.querySelector("#i1");
        function f(x) {
            let imgName = x == 1 ? "c.jpg" : "b.jpg"; //得到图片名
            for (let i = 0; i < input.value; i++) {
                //创建图片标签
                let img = document.createElement("img");
                //设置图片标签属性
                img.src = imgName;
                //将图片标签添加到body中
                document.body.append(img);
            }
        }
    </script>
</body>
</html>